package edu.nanyang.struts;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import edu.nanyang.domain.City;
import edu.nanyang.hibernate.service.ICityService;

public class CityAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2963898626502130109L;
	private ICityService cityService;
	private List<City> list;
	private int provinceId;
	private String result;
	private String cityName;
	// action方法
	public String acquirtCityByProvinceId() {
		System.out.println("----------------");
		list = this.cityService.acquireCityByProvinceId(provinceId);
		return SUCCESS;
	}
	public String addCity(){
		City c =new City();
		c.setName(cityName);
		result=this.cityService.addCity(c,provinceId);
		return SUCCESS;
	}
	public String getResult() {
		return result;
	}

	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	public void setResult(String result) {
		this.result = result;
	}

	public void setCityService(ICityService cityService) {
		this.cityService = cityService;
	}

	public List<City> getList() {
		return list;
	}

	public void setList(List<City> list) {
		this.list = list;
	}

	public int getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(int provinceId) {
		this.provinceId = provinceId;
	}

}
